﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.ComponentModel.DataAnnotations;

namespace MvcApplication1.Models
{
    public class Category
    {
        [ScaffoldColumn(false)]
        public int CategoryID { get; set; }
        public int ParentID { get; set; }
        public string CategoryName { get; set; }
        public string CategoryDescription { get; set; }


        public virtual List<Product> Products { get; set; }

        public IEnumerable<SubCategory> SubCategoryList
        {
            get;
            set;
        }

        [NotMapped]
        public int SubCategoryCount
        {
            get;
            set;
        }

        [NotMapped]
        public int ProductCount
        {
            get;
            set;
        }
    }


    [ComplexType]
    public class SubCategory
    {

        private int _categoryID;
        private int _parentID;
        private string _categoryName;
        private string _categoryDescription;

        public SubCategory(int categoryID, int parentID, string categoryName, string categoryDescription)
        {
            _categoryID = categoryID; ;
            _parentID = parentID;
            _categoryName = categoryName;
            _categoryDescription = categoryDescription;
        }

        public SubCategory()
        {
        }



        public int CategoryID
        {
            get { return _categoryID; }
            set { _categoryID = value; }
        }
        public int ParentID
        {
            get { return _parentID; }
            set { _parentID = value; }
        }
        public string CategoryName
        {
            get { return _categoryName; }
            set { _categoryName = value; }
        }
        public string CategoryDescription
        {
            get { return _categoryDescription; }
            set { _categoryDescription = value; }
        }
    }
}